Skip to content

Conversation

kev-cao
Copy link
Contributor

@kev-cao kev-cao commented Oct 10, 2025

This patch teaches the LDR offline scan processor to emit checkpoint range stats and update the logical_replication.scanning_ranges and logical_replication.catchup_ranges metrics.

Informs: #152273

Release note: LDR now updates the logical_replication.scanning_ranges and logical_replication.catchup_ranges metrics during fast initial scan.

@kev-cao kev-cao requested a review from a team as a code owner October 10, 2025 20:19
@kev-cao kev-cao requested review from jeffswenson and removed request for a team October 10, 2025 20:19
Copy link

blathers-crl bot commented Oct 10, 2025

It looks like your PR touches production code but doesn't add or edit any test code. Did you consider adding tests to your PR?

🦉 Hoot! I am a Blathers, a bot for CockroachDB. My owner is dev-inf.

@cockroach-teamcity
Copy link
Member

This change is Reviewable

@kev-cao
Copy link
Contributor Author

kev-cao commented Oct 10, 2025

Screenshots

image image

I think some additional work could probably be done for the job messages to make it more clear that we've moved from offline scan to the steady state. Just a one-liner adding a job message when the offline processor is complete is probably sufficient.

@kev-cao kev-cao requested a review from Copilot October 10, 2025 23:41
Copy link

@Copilot Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull Request Overview

This PR enhances the LDR offline scan processor to emit checkpoint range statistics and update the logical_replication.scanning_ranges and logical_replication.catchup_ranges metrics during fast initial scans.

Key changes:

  • Added range statistics collection to the offline initial scan processor
  • Refactored error handling in the Next() method for better maintainability
  • Enhanced checkpoint processing to include range statistics

Reviewed Changes

Copilot reviewed 2 out of 2 changed files in this pull request and generated 1 comment.

File Description
pkg/crosscluster/logical/offline_initial_scan_processor.go Added range statistics channel, refactored error handling, and enhanced checkpoint processing to emit range stats
pkg/crosscluster/logical/logical_replication_job.go Added tracking of write processor count for metrics

Tip: Customize your code reviews with copilot-instructions.md. Create the file or learn how to get started.

This patch teaches the LDR offline scan processor to emit checkpoint
range stats and update the `logical_replication.scanning_ranges` and
`logical_replication.catchup_ranges` metrics.

Informs: cockroachdb#152273

Release note: LDR now updates the `logical_replication.scanning_ranges`
and `logical_replication.catchup_ranges` metrics during fast initial
scan.
@kev-cao kev-cao force-pushed the logical/offline-metrics branch from 7c54aaa to 02bdcbc Compare October 10, 2025 23:44
@msbutler msbutler self-requested a review October 14, 2025 19:58
Copy link
Collaborator

@msbutler msbutler left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Nice!

sourceSpans []roachpb.Span
partitionPgUrls []string
destTableBySrcID map[descpb.ID]dstTableMetadata
sourceSpans []roachpb.Span
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

what autoformatter do you use? is it more than crlfmt?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

It should just be crlfmt 🤔

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Oh this particular formatting case I think happened because of the comment — I believe crlfmt only indents types for fields that are adjacent, and a comment breaks that adjacency.

@kev-cao
Copy link
Contributor Author

kev-cao commented Oct 17, 2025

TFTR!

bors r=msbutler

@craig
Copy link
Contributor

craig bot commented Oct 17, 2025

@craig craig bot merged commit 6cabe06 into cockroachdb:master Oct 17, 2025
33 of 34 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants